﻿package  core.net.socket.cmd {
	
	import core.net.socket.SocketCmd;
	import com.adobe.serialization.json.JSON;
	
	public class BluetoothDataCmd implements SocketCmd {

		public static var COMMAND_ID:String = "CMD_BLUETOOTH_DATA";
		
		public static var BATTERY:String = "BATTERY";//电量
		public static var FLOWER_COUNT:String = "FLOWER_COUNT";//离线红花数量
		public static var UPDATE_DATETIME:String = "UPDATE_DATETIME";//校准时间
		public static var WRITE_TEACHER_ID:String = "WRITE_TEACHER_ID";//写魔法棒
		public static var FLOWER_DATA:String = "FLOWER_DATA";//上传离线数据
		public static var WRITE_CARD_ID:String = "WRITE_CARD_ID"; //写红花卡（暂时不用实现）
		
		public var bluetoothCmd:String;
		public var data:Object = new Object();
		public function BluetoothDataCmd() {
			
		}
		
		
		public static function make(bluetoothCmd:String,data:Object):SocketCmd{
			var cmd:BluetoothDataCmd = new BluetoothDataCmd();
			cmd.bluetoothCmd = bluetoothCmd;
			if(data){
				cmd.data = data;
			}
			return cmd;
		}
		
		public function commandString():String{
			var obj = {
				cmd:COMMAND_ID,
				bluetoothCmd:bluetoothCmd,
				data:data
			};
			var str:String = com.adobe.serialization.json.JSON.encode(obj);
			return str;
		}

	}
	
}
